// 引入mongoose接口
const mongoose = require("mongoose");
const {projectionHall}=require("./data/projectionHall")
// 初始化model
const schema=new mongoose.Schema({
    name : String, // 放映厅名字    
    status : Boolean, // 放映厅是否营业（可选）  
    cinemasId:{type:"ObjectId",ref:"cinemas"},  
    // cinemasId : String, // 放映厅所属影院的id
    projectionId:Number   // 放映厅id
});
// 添加并定义model
const projectionHallModel=mongoose.model("projectionHall",schema,"projectionHall")

mongoose.connect(
    "mongodb://tangzhenhua:Lovo123456@182.92.214.223:8084/heshumiao",
    {
        useNewUrlParser: true,
        useUnifiedTopology: true,
        auth: { authSource: "admin" }
      },
    async () => {
        await projectionHallModel.create(projectionHall);
        console.log("connect mongodb://localhost:27017/heshumiao");
    }
);
